//
//  EditCellAdapter.swift
//  Bee
//
//  Created by kyson on 15/12/31.
//  Copyright © 2015年 kyson. All rights reserved.
//

import UIKit

class EditCellAdapter: NSObject,UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,UICollectionViewDelegate {

    
    @available(iOS 6.0, *)
    internal func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int{
        var number: Int!
        switch(section){
        case 0:
            number = 10
            break
//        case 1:
//            number = 4
//            break
//        case 2:
//            number = 6
//            break
        default:
            break
        }
        return number
    }
    
    // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
    @available(iOS 6.0, *)
    internal func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell{
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("editpic", forIndexPath: indexPath)
        let editCell = cell as! EditPicCell
        editCell.setContentImage(url: "http://7xlk5t.com1.z0.glb.clouddn.com/uploads/images/201510/13/8/ypWlqHcwaE.jpg")
        return cell
    }
    
    
//    internal func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize{
//        return CGSizeMake(UIScreen.mainScreen().bounds.width, 8)
//    }
    
    internal func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize{
        var size:CGSize!
        switch(indexPath.section){
        case 0:
            
            if(DeviceType.IS_IPHONE_4_OR_LESS){
                size = CGSizeMake(50, 50)
            }else if(DeviceType.IS_IPHONE_5){
                size = CGSizeMake(50, 50)

            }else if(DeviceType.IS_IPHONE_6){
                size = CGSizeMake(50, 50)
            }else if(DeviceType.IS_IPHONE_6P){
                size = CGSizeMake(90, 90)
            }
            
            break
//        case 1:
//            size = CGSizeMake(50, 40)
//            break
//        case 2:
//            size = CGSizeMake(60, 30)
//            break
        default:
            break
        }
        return size
    }
    
    
//    internal func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAtIndex section: Int) -> CGFloat{
//        return 2
//    }
//    
//    
//    internal func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets{
//        return UIEdgeInsetsMake(0, 0, 0, 0)
//    }
//    
    internal func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int{
        return 1
    }

}
